{include file="public/header" /}
{include file="public/banner_In" /}
<div class="layui-container">
    <div class="layui-row layui-col-space20">
        {include file="public/left" /}
        <div class="layui-col-sm9 layui-col-md10">
            {include file="public/location" /}
            <div class="layui-card fly-extend-doc layui-show body-height-page">
                <div class="layui-card-header"><h3 class="layui-inline layui-this">{$title}</h3></div>

                <div class="layui-card-body detail-body layui-text">
                    <blockquote class="layui-elem-quote layui-text">
                        {$content|raw}
                    </blockquote>
                    <div class="content">
                        <form class="layui-form" id="layuiForm">
                            {:token()}
                            <input type="hidden" name="id" value="5" />
                            <input type="hidden" name="modelField[site_id]" value="{$siteId}" />
                            <div class="layui-form-item">
                                <label class="layui-form-label">{:lang('Name')}</label>
                                <div class="layui-input-block">
                                    <input type="text" name="modelField[name]" required  lay-verify="required" placeholder="{:lang('enterName')}" lay-reqText="{:lang('enterName')}" autocomplete="off" class="layui-input" value="">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label layui-form-item-required">{:lang('phone')}</label>
                                <div class="layui-input-block">
                                    <input type="text" name="mobile" required  lay-verify="required|phone" placeholder="{:lang('inputPhone')}" autocomplete="off" class="layui-input" value="">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label layui-form-item-required">手机验证码</label>
                                <div class="layui-input-inline" style="width: 60%;">
                                    <input type="text" name="captcha_mobile" required="" lay-verify="required" autocomplete="off" value="" class="layui-input" placeholder="手机验证码"> </div>
                                <button class="layui-btn btn-captcha layui-btn-primary layui-border-green" type="button" data-event="formguide" data-type="mobile" data-url="{:url('api/sms/send')}">获取验证码</button>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label layui-form-item-required">{:lang('email')}</label>
                                <div class="layui-input-block">
                                    <input type="text" name="email" required  lay-verify="required|email" placeholder="{:lang('inputEmail')}" autocomplete="off" class="layui-input" value="">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label layui-form-item-required">邮箱验证码</label>
                                <div class="layui-input-inline" style="width: 60%;">
                                    <input type="text" name="captcha_email" required="" lay-verify="required" autocomplete="off" value="" class="layui-input" placeholder="邮箱验证码"> </div>
                                <button class="layui-btn btn-captcha layui-btn-primary layui-border-green" type="button" data-event="formguide" data-type="email" data-url="{:url('api/ems/send')}">获取验证码</button>
                            </div>

                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label layui-form-item-required">{:lang('messageContent')}</label>
                                <div class="layui-input-block">
                                    <textarea placeholder="{:lang('enterMessage')}" class="layui-textarea" name="modelField[content]"></textarea>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label layui-form-item-required">{:lang('captcha')}</label>
                                <div class="layui-input-block verify-box">
                                    <input type="text" name="captcha" lay-verify="required" placeholder="{:lang('captcha')}" autocomplete="off" class="layui-input" style="width: 200px">
                                    <img id="verify" src="{:captcha_src()}" alt="{:lang('captcha')}" class="captcha">
                                </div>
                            </div>


                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="formDemo">{:lang('submit')}</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">{:lang('reset')}</button>
                                </div>
                            </div>
                        </form>

                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script src="__STATIC__/libs/layui/layui.js"></script>
<script src="__STATIC__/libs/jquery/jquery.min.js"></script>
{include file="../member/public/layui" /}
<script type="text/javascript">
    layui.use(['form', 'layer','yznForm'], function() {
        var form = layui.form,
            layer = layui.layer,
            yznForm = layui.yznForm;

        //监听提交
        form.on('submit(formDemo)', function (data) {
            $.ajax({
                url:'/formguide/index/post.html',
                type:'post',
                data:data.field,
                dataType: 'json',
                success:function(data){
                    if(data.code==1){
                        layer.msg(data.msg,{icon: 1});
                        $("#layuiForm")[0].reset();
                        layui.form.render();
                    }
                    else{
                        layer.msg(data.msg,{icon: 2});
                        return false;
                    }
                },
                error:function(e){
                    layer.msg(data.msg,{icon: 2});
                    return false;
                },
            });
            return false;
        });

        //刷新验证码
        $("#verify").click(function() {
            var verifyimg = $("#verify").attr("src");
            $("#verify").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
        });
    });
</script>
